package ruiFight.collect.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import ruiFight.collect.dao.ManagerMapper;
import ruiFight.collect.model.Manager;
import ruiFight.collect.service.base.BaseServiceImpl;

@Service
public class ManagerServiceImpl extends BaseServiceImpl<Manager, Long> implements ManagerService {

    @Resource
    private ManagerMapper managerMapper ;
//    @Resource
//    private ManagerAddressMapper managerAddressMapper;

    public Manager findManagerByCondition(Manager manager) {
        Manager actManager = managerMapper.findManagerByCondition(manager);
        return actManager;
    }
    
	//@Override
	public Map<String, Object> getManagerList(Map<String, Object> paramMap) {
		List<Map<String, Object>> mapList=managerMapper.getManagerList(paramMap);
		Integer count=managerMapper.getManagerCount(paramMap);
		//分页数据
		Map<String, Object> dataMap=new HashMap<String, Object>();
		dataMap.put("totalCount", count);
		dataMap.put("list", mapList);
		dataMap.put("currentPage", paramMap.get("currentPage"));
		return dataMap;
	}
	public void addAllocateAddress(int parseInt, int parseInt2, int parseInt3) {
//		Map<String, Object> paramMap=new HashMap<String, Object>();
//		paramMap.put("addId", parseInt);
//		paramMap.put("managerId", parseInt2);
//		paramMap.put("flag", parseInt3);
//		managerAddressMapper.addManagerAllocate(paramMap);
	}
	public Integer verifyPassword(Manager manager) {
		return managerMapper.verifyPassword(manager);
	}
	public Integer verifyUserName(String userName) {
		return managerMapper.verifyUserName(userName);
	}
	
	public Integer login(String loginCode,String passWord) {
		Integer str = 0;
		Manager manager = new Manager();
		manager.setLoginCode(loginCode);
		manager.setLoginPassword(passWord);
		Manager actManager = managerMapper.findManagerByCondition(manager);
		if(actManager != null) {
			str = 1;
		}
		return str;
	}
}
